package cn.com.yiqi.wsc.dao.order;

import cn.com.yiqi.wsc.Ro.CartVO;
import cn.com.yiqi.wsc.entity.order.OrderSub;
import cn.com.yiqi.wsc.entity.order.OrderSubExample;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface OrderSubMapper {

    int updateStatus(@Param("orderId") Long orderId, @Param("status") Integer status);

    int deleteByPrimaryKey(Integer id);


    int insertSelective(OrderSub record);

    List<OrderSub> selectByExample(OrderSubExample example);

    OrderSub selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(OrderSub record);

    OrderSub selectByUserIdAndId(@Param("userId") Integer userId, @Param("id") Integer id);

    void changeStatus(@Param("orderId") Integer id, @Param("status") Integer value);

    CartVO findOrderSub(@Param("id") Integer id, @Param("url") String url);

    List<OrderSub> getOrderItems(@Param("orderId") Long orderId);


    /**
     * 获取状态数量
     *
     * @param orderId
     * @param status
     * @return
     */
    Integer countSubByOrderIdAndStatus(@Param("orderId") Integer orderId, @Param("status") Integer status);

    /**
     * 获取数量
     *
     * @param orderId
     * @return
     */
    Integer countSubByOrderId(@Param("orderId") Integer orderId);
}